3 research outputs found

    Normalisierung und partielle Auswertung von funktional-logischen Programmen

    Get PDF
    This thesis deals with the development of a normalization scheme and a partial evaluator for the functional logic programming language Curry. The functional logic programming paradigm combines the two most important fields of declarative programming, namely functional and logic programming. While functional languages provide concepts such as algebraic data types, higher-order functions or demanddriven evaluation, logic languages usually support a non-deterministic evaluation and a built-in search for results. Functional logic languages finally combine these two paradigms in an integrated way, hence providing multiple syntactic constructs and concepts to facilitate the concise notation of high-level programs. However, both the variety of syntactic constructs and the high degree of abstraction complicate the translation into efficient target programs. To reduce the syntactic complexity of functional logic languages, a typical compilation scheme incorporates a normalization phase to subsequently replace complex constructs by simpler ones until a minimal language subset is reached. While the individual transformations are usually simple, they also have to be correctly combined to make the syntactic constructs interact in the intended way. The efficiency of normalized programs can then be improved by means of different optimization techniques. A very powerful optimization technique is the partial evaluation of programs. Partial evaluation basically anticipates the execution of certain program fragments at compile time and computes a semantically equivalent program, which is usually more efficient at run time. Since partial evaluation is a fully automatic optimization technique, it can also be incorporated into the normal compilation scheme of programs. Nevertheless, this also requires termination of the optimization process, which establishes one of the main challenges for partial evaluation besides semantic equivalence. In this work we consider the language Curry as a representative of the functional logic programming paradigm. We develop a formal representation of the normalization process of Curry programs into a kernel language, while respecting the interference of different language constructs. We then define the dynamic semantics of this kernel language, before we subsequently develop a partial evaluation scheme and show its correctness and termination. Due to the previously described normalization process, this scheme is then directly applicable to arbitrary Curry programs. Furthermore, the implementation of a practical partial evaluator is sketched based on the partial evaluation scheme, and its applicability and usefulness is documented by a variety of typical partial evaluation examples

    Integration of Finite Domain Constraints in KiCS2 ∗

    No full text
    Abstract: A constraint programming system usually consists of two main components: a modelling language used to describe a constraint satisfaction problem and a constraint solver searching for solutions to the given problem by applying specific algorithms. As constraint programming and functional logic languages share some common features, like computing with logic variables or the use of backtracking for non-deterministic search, it is reasonable to embed a modelling language for finite domain constraints in a functional logic language like Curry. Due to the absence of side effects or global state over non-deterministic computations in Curry, the implementation of a stateful constraint solver is rather difficult. In this paper we consider KiCS2, a Curry compiler translating Curry programs into Haskell programs. In order to embed finite domain constraints in KiCS2, we propose a new implementation technique compatible with the purely functional nature of its back end. Our implementation collects finite domain constraints occurring during a program run and passes them to a constraint solver available in Haskell whenever solutions are requested.
    corecore